import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
 * A method in the abstract syntax which contains a list of classes and abstract syntax tree
 * of the code below
 *
 */
public class AbstractAndroidMethod {
	
	private String name;
	private AbstractAndroidClass androidClass;
	List <ExprS> astList;
	
	public AbstractAndroidMethod(String name) {
		this.name = name;
		astList = new ArrayList <ExprS> ();
	}
	
	public AbstractAndroidMethod(String name, AbstractAndroidClass androidClass) {
		this(name);
		setAndroidClass(androidClass);
	}

	public void setName(String name) {
		this.name = name;
	}
	
	public void setAstList(List<ExprS> astList) {
		this.astList = astList;
	}
	
	public String getName() {
		return name;
	}
	
	public List<ExprS> getAstList() {
		return astList;
	}
	
	public void setAndroidClass(AbstractAndroidClass androidClass) {
		if(this.androidClass != androidClass) {
			this.androidClass = androidClass;
			androidClass.addAbstractAndroidMethod(this);
		}
	}
	
	public AbstractAndroidClass getAndroidClass() {
		return androidClass;
	}	
	
	public boolean equal(Object obj) {
		if (!(obj instanceof AbstractAndroidMethod)) {
			return false;
		}
		AbstractAndroidMethod methodObj = (AbstractAndroidMethod) obj;
		return methodObj.getName() == name;
	}
	
}
